<!--
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-07-30 20:02:30
 * @LastEditTime: 2020-03-21 12:23:57
 * @LastEditors: Please set LastEditors
 -->
<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport"
		content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title>Hello APP</title>
	<link rel="stylesheet" type="text/css" href="../css/vant.css">
	<link rel="stylesheet" type="text/css" href="../css/base.css" />
	<script type="text/javascript" src="../script/jquery.js"></script>
	<script type="text/javascript" src="../script/layer/mobile/layer.js"></script>
	<script type="text/javascript" src="../script/vue.min.js"></script>
	<script type="text/javascript" src="../script/vant.min.js"></script>
	<script type="text/javascript" src="../script/fastclick.js"></script>
	<script type="text/javascript" src="../script/base.js"></script>
	<script type="text/javascript" src="../script/db.js"></script>
	<style type="text/css">
		.main-animate {
			height: 484px;
			overflow: hidden;
			transition: all .4s;
		}

		.toggle-1 {
			text-align: center;
			padding: 10px 0;
		}

		.toggle-1 img {
			width: 20px;
			transition: all .4s;
		}

		.toggle-1 img.rotate {
			transform: rotate(180deg);
		}

		.p-select {
			padding: 0 30px 15px;
		}

		.p-select span,
		.p-select i {
			vertical-align: middle;
		}

		.item>.van-cell__title {
			max-width: inherit;
		}

		.item .tag {
			display: inline-block;
			width: 20px;
			height: 20px;
			vertical-align: middle;
			background: #cd1b21;
			color: #fff;
			font-size: 12px;
			text-align: center;
			line-height: 20px;
			border-radius: 2px;
			position: relative;
			left: -18px;
		}

		.title {
			height: 36px;
			position: relative;
			padding-bottom: 10px;
			border-bottom: 1px dashed #cd1b21;
		}

		.title .title-text {
			float: left;
		}

		.title .title-text span {
			vertical-align: middle;
		}

		.title .title-num {
			float: right;
		}

		.title .title-num .arrow-toggle {
			display: inline-block;
			margin-left: 12px;
			width: 24px;
			text-align: center;
		}

		.title .title-num .arrow-toggle img {
			width: 16px;
			vertical-align: middle;
		}

		.title .title-num .arrow-toggle img.rotate {
			width: 16px;
			vertical-align: middle;
			transform: rotate(180deg);
		}

		.delete {
			width: 16px;
			height: 16px;
		}

		.delete img {
			width: 16px;
			vertical-align: text-top;
		}

		.txt {
			display: inline-block;
			max-width: 120px;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.detail {
			height: 210px;
			overflow: hidden;
			transition: all .4s;
		}

		.detail .van-cell {
			padding: 10px 0;
		}

		.detail .van-cell:not(:last-child)::after {
			left: 0;
		}

		.hide {
			height: 0;
		}

		.shadow {
			box-shadow: 0 0 5px rgb(200, 198, 198);
			position: relative;
			background: #fff;
		}

		.font-danger .van-stepper__input {
			color: #cd1b21;
		}

		.sq {
			display: inline-block;
			width: 4px;
			height: 14px;
			background: #cd1b21;
			vertical-align: text-bottom;
			left: -15px;
			position: relative;
			box-shadow: 1px 0px 3px 0 #cd1b21;
		}

		.mode-title {
			padding: 10px 15px;
			font-size: 14px;
			font-weight: 700;
			background: #cd1b21;
			color: #fff;
		}

		.mode-warning {
			line-height: 46px;
			padding: 0 15px;
			font-weight: 700;
			background: #fff;
			color: #cd1b21;
		}

		.mode-type {
			line-height: 46px;
			padding: 0 15px;
			font-weight: 700;
			background: #fff;
		}

		.mode-type:active {
			background: #e6e6e6;
		}
	</style>
</head>

<body>
	<div id="app" v-cloak>
		<div class="init-full" @click="clickDom($event)">
			<van-nav-bar class="head" title="销售出库" left-arrow @click-left="onClickLeft">
				<div slot="right" class="head-right" v-show="!isDisabled">
					<span @click.stop="approvalForm" v-show="isAllowApproval != 0 && status < 24">审批</span>
					<span @click.stop="showMenu = !showMenu">
						<img src="../image/menu.png" />
					</span>
				</div>
			</van-nav-bar>
			<div class="body-with-bottom">
				<van-pull-refresh :disabled="loadingDisabled" v-model="refreshLoading" @refresh="onRefresh">
					<div class="content content-padding">

						<div style="padding: 0 10px 15px;">
							<div class="shadow">
								<div class="content-label">基本信息</div>
								<div>
									<van-cell :value="formData.ClientName" is-link @click="openScreen(-1,10)">
										<div slot="title">
											<span class="sq"></span>
											<span style="margin-left:-8px;">往来单位</span>
										</div>
									</van-cell>
									<van-field style="display: none;"></van-field>
								</div>
								<div class="main-animate" :class="!showMain?'hide':''">
									<van-field label="收款金额" v-model="formData.RecMoney" type="number"></van-field>
									<van-field label="抹零金额" v-model="formData.PerMoney" type="number">
										<div slot="right-icon" style="color:#cd1b21;" v-if="formData.RecMoney"
											@click="reduceCount">抹零</div>
									</van-field>
									<van-cell title="分支机构" :value="formData.BranchName" is-link
										@click="openBranchChange">
									</van-cell>
									<van-cell title="经手人" :value="formData.EmplName" is-link @click="openScreen(-1,21)">
									</van-cell>
									<van-cell title="部门" :value="formData.ClassName" is-link @click="openScreen(-1,20)">
									</van-cell>
									<van-cell title="仓库" :value="formData.StockName" is-link @click="openScreen(-1,36)">
									</van-cell>
									<!-- {{formData.StockID}} {{formData.CargoID}} {{formData.CargoName}} -->
									<van-cell title="收款账户" :value="formData.ProjectName" is-link
										@click="openScreen(-1,40)">
									</van-cell>
									<van-cell title="VIP卡" :value="formData.VIPName" is-link @click="openScreen(-1,50)">
									</van-cell>
									<van-cell title="预设售价" :value="formData.PriceNName" is-link
										@click="openScreen(-1,70)">
									</van-cell>
									<van-field label="备注" v-model="formData.Explain"></van-field>
									<van-cell title="出库方式" :value="formData.BTypeName" is-link
										@click="openScreen(-1,111)">
									</van-cell>
								</div>

								<div class="toggle-1" @click="toggleShowMain">
									<img src="../image/retract.png" :class="!showMain?'rotate':''" />
								</div>

							</div>
						</div>

						<div class="p-select" v-if="type != 3">

							<van-row gutter="30">
								<van-col span="12">
									<van-button type="primary" block size="small" @click="openScan">
										<van-icon name="scan"></van-icon>
										<span>扫描二维码</span>
									</van-button>
								</van-col>
								<van-col span="12">
									<van-button type="primary" block size="small" @click="openScreen(-1,60)">
										<van-icon name="add-o"></van-icon>
										<span>选择商品</span>
									</van-button>
								</van-col>
							</van-row>
						</div>
						<div style="padding: 0 10px 15px;">
							<div class="shadow">
								<div class="content-label">销售明细</div>
								<div class="no-data" v-show="!formDetailData.length">暂无数据</div>
								<div>
									<van-cell class="item" :border="false" v-for="(row,index) in formDetailData">
										<div slot="title" class="title">
											<div class="title-text">
												<span class="tag">{{formDetailData.length - index}}</span>
												<span class="delete" @click="deleteRow(row,index)">
													<img src="../image/delete.png" />
												</span>
												<span class="txt">{{row.name}}</span>
											</div>
											<div class="title-num">
												<span v-if="type == 3">{{row.num}}</span>
												<span v-else>
													<van-stepper button-size="24" integer min="0"
														:class="row.num>row.stockNum?'font-danger':''" v-model="row.num"
														@change="changeStepper(row)">
													</van-stepper>
												</span>
												<span class="arrow-toggle" @click="toggleShowDetail(row)">
													<img src="../image/retract.png"
														:class="!row.showDetail?'rotate':''" />
												</span>
											</div>
										</div>
										<div slot="label" class="detail" :class="!row.showDetail?'hide':''">
											<div>
												<!-- <van-cell title="单价" :value="row.price"></van-cell> -->
												<van-field label="单价" type="number" v-model="row.price"
													v-on:input="changeStepper(row)">
												</van-field>
												<van-cell title="金额" :value="row.price*row.num"></van-cell>
												<van-cell title="仓库" :value="row.stockName"></van-cell>
												<van-cell title="库位" :value="row.cargoName" is-link
													@click="openScreen(index,31)"></van-cell>
												<van-cell title="虚拟库存" :value="row.stockNum"></van-cell>
											</div>
										</div>
									</van-cell>

								</div>
							</div>
						</div>


						<img class="seal" :src="getSealImage()" v-if="sealType!=0" />
						<img class="seal" src="../image/ysl.png" style="width: 70px;" v-if="CGZT == 2" />
						<img class="seal" src="../image/th.png" style="width: 70px;" v-if="CGZT == 3" />
						<img class="seal" :src="getApprovalImage()"
							v-if="(status == 17 || status == 18 || status == 22 || status == 24 || status == 26 || status == 28) && !sealType" />
					</div>
				</van-pull-refresh>
				<van-loading v-if="showLoading" />
			</div>
			<!-- <div class="bottom">
				<div class="bottom-left-label">
					<span>合计:</span>
					<span class="number">{{getTotalCount()}}</span>
					<span class="number">￥{{getTotalPrice()}}</span>
				</div>
				<div class="bottom-right-button">
					<van-button :disabled="ifConfirm || type == 3" :loading="ifConfirm" loading-text="数据提交中..."
						type="primary" block @click="submitForm">{{type == 3?'已过账':'提交'}}</van-button>
				</div>
			</div> -->

			<div class="bottom">
				<div class="bottom-left-label_">
					<span>合计:</span>
					<span class="number">{{getTotalCount()}}</span>
					<span class="number">￥{{getTotalPrice()}}</span>
				</div>
				<div class="bottom-right-button_" v-show="!isDisabled">
					<div class="rad" v-show="type != 1">
						<van-button class="b-color-1" style="border-radius:15px 0 0 15px;"
							:disabled="ifConfirm || type == 3" :loading="ifConfirm" loading-text="数据提交中..."
							type="primary" @click="isPaySubmit = false;submitForm()">{{type == 3?'已过账':'提交'}}
						</van-button>
						<van-button class="b-color-2" style="border-radius:0 15px 15px 0;"
							:disabled="ifConfirm || isPay == 1" type="primary" @click="payForm">{{payText}}
						</van-button>
					</div>

					<div class="rad" v-show="type == 1">
						<van-button class="b-color-1" style="border-radius:15px 0 0 15px;" :disabled="ifConfirm"
							type="primary" @click="draftSave">保存草稿
						</van-button>
						<van-button class="b-color-2" style="border-radius:0 15px 15px 0;" :disabled="ifConfirm"
							:loading="ifConfirm" loading-text="数据提交中..." type="primary" @click="draftSubmitForm">提交出库
						</van-button>
					</div>

				</div>

			</div>
		</div>

		<van-popup v-model="showDistribute" round position="bottom">
			<div>
				<van-cell title="拣货人员" :value="distribute.personName" is-link @click="openScreen(-1,230)">
				</van-cell>
			</div>
			<div class="btn-padding">
				<van-button type="primary" block style="border-radius: 0;" @click="distributeSubmit">提交</van-button>
			</div>
		</van-popup>

		<van-popup v-model="showMode" :close-on-click-overlay="false" style="width: 80%;">
			<div style="font-size: 14px;">
				<div class="mode-title">请选择本次出库的出库方式</div>
				<div v-for="row in outgoingMode" @click="selectMode(row)">
					<div class="mode-type">{{row.name}}</div>
				</div>
				<div v-if="serviceRemark" class="mode-warning">
					{{serviceRemark}}
				</div>
			</div>
		</van-popup>

		<div class="head-menu" v-if="showMenu">
			<img class="menu-arrow" src="../image/menu-arrow.png" />
			<div @click="approvalForm" v-show="status >= 24 && status < 80 && isAllowApproval != 0">
				<img src="../image/approval.png" />
				<span>审批</span>
			</div>
			<div @click="postingForm" v-show="formID != 0 && isAllowApproval == 0 && type != 1">
				<img src="../image/posting.png" />
				<span>审核过账</span>
			</div>
			<div @click="orderOut" v-show="CGZT == 1 && formData.BType == 'BH'">
				<img src="../image/posting.png" />
				<span>订货出库</span>
			</div>
			<div @click="ShortageOut" v-show="CGZT == 1 && formData.BType == 'BH'">
				<img src="../image/posting.png" />
				<span>缺货退回</span>
			</div>
			<div @click="reOrderOut" v-show="(CGZT == 2 || CGZT == 3) && formData.BType == 'BH'">
				<img src="../image/posting.png" />
				<span>重新订货</span>
			</div>
			<div @click="distributeOrder"
				v-show="formData.BranchID == 1 && isAllowApproval == 1 && status > 20 && status < 80">
				<img src="../image/posting.png" />
				<span>拣货分配</span>
			</div>
			<div @click="printBill" v-show="type != 0">
				<img src="../image/print.png" />
				<span>打印</span>
			</div>
			<div @click="openHistory" v-show="type == 0">
				<img src="../image/history.png" />
				<span>历史单据</span>
			</div>
			<div @click="openVin">
				<img src="../image/vin.png" />
				<span>扫描VIN</span>
			</div>
			<div @click="saveLocal" v-show="type == 0">
				<img src="../image/draft.png" />
				<span>保存草稿</span>
			</div>
			<div @click="openNavigation" v-show="status == 22 || isAllowApproval == 0">
				<img src="../image/navigation.png" />
				<span>导航</span>
			</div>
		</div>

		<van-dialog v-model="showPay" close-on-click-overlay @confirm="moneyPay">
			<div style="padding-top:30px;">
				<van-field label="收款金额" v-model="collectedAmount" placeholder="请输入收款金额"></van-field>
			</div>
		</van-dialog>

		<van-dialog v-model="showApproval" show-cancel-button close-on-click-overlay confirm-button-text="通过"
			cancel-button-text="不通过" @confirm="approvalConfirm" @cancel="approvalCancel">
			<div style="padding-top:10px;">
				<div style="color: #cd1b21;font-size:13px;line-height: 30px;padding-left:15px;"
					v-show="status >= 24 && status < 80 && isAllowApproval != 0">温馨提示：审核过账后,客户将无法确认和支付</div>
				<van-field label="原因" v-model="approvalReason" placeholder="请输入审批通过/不通过原因"></van-field>
			</div>
		</van-dialog>

	</div>
</body>

<script type="text/javascript">
	var vm;
	apiready = function () {
		// //$('.init-full').show();

		var maps = [
			['高德地图', 'iosamap://', 'com.autonavi.minimap'],
			['百度地图', 'baidumap://', 'com.baidu.BaiduMap']
		];
		var buttons = [];

		api.addEventListener({
			name: 'keyback'
		}, function (ret, err) {
			vm.onClickLeft();
		});

		api.addEventListener({
			name: 'reloadForm'
		}, function (ret, err) {
			if (historyData) {
				var time = ret.value.time || 0;
				setTimeout(function () {
					var obj = {
						S_BillType: 101,
						S_BillID: vm.formID
					}
					FLD.ajax('AP_HisList_XX', obj, function (res) {
						var row = res.ds[0];
						api.openWin({
							name: 'selling',
							url: 'sellingPrint.html',
							reload: true,
							slidBackEnabled: false,
							pageParam: {
								historyData: row
							}
						})
					})
				}, time)


			}

		})

		api.addEventListener({
			name: 'vinSelected'
		}, function (ret, err) {
			var detailString = ret.value.detailString;
			var obj = {
				S_Type: 61,
				S_Cont: '',
				S_BranchID: vm.formData.BranchID,
				S_SXZ: '',
				S_StockID: vm.formData.StockID,
				S_CargoID: vm.formData.CargoID,
				S_BarCode: detailString,
				S_PriceN: vm.formData.PriceN,
				S_ProductID: 0
			}
			FLD.ajax('AP_BasList', obj, function (res) {
				for (var i in res.ds) {
					var row = res.ds[i];
					vm.formDetailData.unshift({
						showDetail: false,
						hasEdit: false,
						id: row.id,
						detailID: 0,
						name: row.name,
						code: row.code,
						spec: row.Spec,
						num: 1,
						price: row.BPrice || 0,
						stockID: vm.formData.StockID,
						stockName: vm.formData.StockName,
						cargoID: vm.formData.CargoID,
						cargoName: vm.formData.CargoName,
						stockNum: row.StockNum,
						unit: row.Unit
					})
				}

			})
		})

		api.addEventListener({
			name: 'selectArray'
		}, function (ret, err) {
			var selectType = ret.value.selectType;
			var type = ret.value.type;
			var array = ret.value.array;
			if (selectType == 60) {
				var newArray = [];


				var repeatArray = function (x) {
					if (x == array.length) {
						vm.formDetailData = newArray.concat(vm.formDetailData);
					} else {
						var row = array[x];
						var p_obj = {
							S_BranchID: vm.formData.BranchID,
							S_ClientID: vm.formData.ClientID,
							S_ProductID: row.id
						}
						FLD.ajax('APP_GETPCNC', p_obj, function (res) {
							newArray.push({
								showDetail: false,
								hasEdit: false,
								id: row.id,
								detailID: 0,
								name: row.name,
								code: row.code,
								spec: row.Spec,
								num: row.num,
								price: res.ds[0].O_DPrice || row.BPrice || 0,
								stockID: vm.formData.StockID,
								stockName: vm.formData.StockName,
								cargoID: vm.formData.CargoID,
								cargoName: vm.formData.CargoName,
								stockNum: row.StockNum,
								unit: row.Unit,
								remark: row.SPBZ
							})
							x++;
							repeatArray(x)
						})
					}
				}
				repeatArray(0)



			}
		})

		api.addEventListener({
			name: 'selectRow'
		}, function (ret, err) {
			var selectType = ret.value.selectType;
			var type = ret.value.type;
			var row = ret.value.row;
			if (selectType == 10) {
				if (row.id != vm.formData.ClientID) {
					vm.formDetailData = [];
				}
				vm.receivableMoney = row.AXMoney;
				vm.formData.ClientName = row.name;
				vm.formData.ClientID = row.id;
				vm.formData.PriceNName = row.S_PriceNName;
				vm.formData.PriceN = row.S_PriceN;
				if (!vm.formData.EmplName) {
					vm.formData.EmplName = row.S_EmplName;
					vm.formData.EmplID = row.S_EmplID;
				}
				if (!vm.formData.ClassName) {
					vm.formData.ClassName = row.S_ClassName;
					vm.formData.ClassID = row.S_ClassID;
				}

				vm.lon = row.Longitude;
				vm.lat = row.Latitude;

				vm.setDataBySelectClient();

			}
			if (selectType == 21) {
				vm.formData.EmplName = row.name;
				vm.formData.EmplID = row.id;
				vm.formData.ClassName = row.S_ClassName;
				vm.formData.ClassID = row.S_ClassID;
			}
			if (selectType == 20) {
				vm.formData.ClassName = row.name;
				vm.formData.ClassID = row.id;
			}
			if (selectType == 30 || selectType == 36) {
				if (type > -1) {
					vm.formDetailData[type].stockName = row.name;
					vm.formDetailData[type].stockID = row.id;
					vm.formDetailData[type].cargoName = row.S_CargoName;
					vm.formDetailData[type].cargoID = row.S_CargoID;
					vm.formDetailData[type].stockNum = row.StockNum;
				} else {
					var x = 0;
					if (row.id != vm.formData.StockID) {
						x = 1;
					}
					vm.formData.StockName = row.name;
					vm.formData.StockID = row.id;
					vm.formData.CargoName = row.S_CargoName;
					vm.formData.CargoID = row.S_CargoID;

					if (x == 1) {
						var S_STRZH = [];
						for (var i in vm.formDetailData) {
							var detailArray = [];
							detailArray.push(
								'\'' + vm.formData.StockID + '\'',
								'\'' + vm.formData.CargoID + '\'',
								'\'' + vm.formDetailData[i].id + '\''
							);
							S_STRZH.push(detailArray.join())
						}
						FLD.ajax('AP_GetSNum_A', { S_STRZH: S_STRZH.join('|') }, function (res) {
							for (var i in res.ds) {
								vm.formDetailData[i].stockName = vm.formData.StockName;
								vm.formDetailData[i].stockID = vm.formData.StockID;
								vm.formDetailData[i].cargoName = vm.formData.CargoName;
								vm.formDetailData[i].cargoID = vm.formData.CargoID;
								vm.formDetailData[i].stockNum = res.ds[i].XStockNum;
							}
						})
					}
				}

			}
			if (selectType == 31) {
				if (type > -1) {
					if (row.id != vm.formDetailData[type].cargoID) {
						vm.formDetailData[type].hasEdit = true;
					}
					vm.formDetailData[type].cargoName = row.name;
					vm.formDetailData[type].cargoID = row.id;
					vm.formDetailData[type].stockNum = row.StockNum;
				}
			}
			if (selectType == 40) {
				vm.formData.ProjectName = row.name;
				vm.formData.ProjectID = row.id;
			}
			if (selectType == 50) {
				vm.formData.VIPName = row.name;
				vm.formData.VIPCardID = row.id;
				vm.formData.ProjectName = row.ProjectName;
				vm.formData.ProjectID = row.ProjectID;
			}
			if (selectType == 60) {
				if (row.StockNum == 0) {
					layer.open({
						content: '当前库位库存不足!',
						skin: 'msg',
						time: 2
					});
				}

				var p_obj = {
					S_BranchID: vm.formData.BranchID,
					S_ClientID: vm.formData.ClientID,
					S_ProductID: row.id
				}
				FLD.ajax('APP_GETPCNC', p_obj, function (res) {
					vm.formDetailData.unshift({
						showDetail: false,
						hasEdit: false,
						id: row.id,
						detailID: 0,
						name: row.name,
						code: row.code,
						spec: row.Spec,
						num: row.num,
						price: res.ds[0].O_DPrice || row.BPrice || 0,
						stockID: vm.formData.StockID,
						stockName: vm.formData.StockName,
						cargoID: vm.formData.CargoID,
						cargoName: vm.formData.CargoName,
						stockNum: row.StockNum,
						unit: row.Unit,
						remark: row.SPBZ
					})
				})


			}
			if (selectType == 70) {
				vm.formData.PriceNName = row.name;
				vm.formData.PriceN = row.id;
			}
			if (selectType == 99) {
				if (vm.formData.BranchID != row.id) {
					vm.formData.BranchName = row.name;
					vm.formData.BranchID = row.id;
					vm.formData.StockName = '';
					vm.formData.StockID = 0;
					vm.formData.CargoName = '';
					vm.formData.CargoID = 0;
				}

			}
			if (selectType == 111) {
				vm.formData.BTypeName = row.name;
				vm.formData.BType = row.id;
			}

			if (selectType == 230) {
				vm.distribute.personName = row.name;
				vm.distribute.personID = row.id;
			}
		});

		var historyData = api.pageParam.historyData;
		var detailString = api.pageParam.detailString;
		var draftID = api.pageParam.draftID;
		var userInfo = FLD.getUserInfo();
		var FNScanner = api.require('FNScanner');
		vm = new Vue({
			el: '#app',
			data: {
				showLoading: false,
				loadingDisabled: true,
				refreshLoading: false,
				showMain: false,
				ifConfirm: false,
				showMenu: false,
				showPay: false,
				showApproval: false,
				approvalReason: '',
				outgoingMode: [],
				serviceRemark: '',	//2022.5.4 added by fy 
				showMode: false,
				isDisabled: api.pageParam.isDisabled || false,
				lon: '',
				lat: '',
				status: 0,
				type: 0,
				billType: 0,
				formID: 0,
				isPay: 0,
				CGZT: 0,
				payText: '支付',
				sealType: 0,
				receivableMoney: 0,
				isAllowApproval: 0,
				isPaySubmit: false,
				formData: {
					ClientID: 0,
					ClientName: '',
					RecMoney: '',
					PerMoney: '',
					BranchID: userInfo.S_BranchID,
					BranchName: userInfo.S_BranchName,
					EmplID: userInfo.S_EmplID,
					EmplName: userInfo.S_EmplName,
					ClassID: userInfo.S_ClassID,
					ClassName: userInfo.S_ClassName,
					StockID: userInfo.S_StockID,
					StockName: userInfo.S_StockName,
					CargoID: userInfo.S_CargoID,
					CargoName: userInfo.S_CargoName,
					ProjectID: userInfo.S_ProjectID,
					ProjectName: userInfo.S_ProjectName,
					VIPCardID: 0,
					VIPName: '',
					PriceN: 0,
					PriceNName: '',
					Explain: '',
					BType: '',
					BTypeName: ''
				},
				collectedAmount: '',
				formDetailData: [],
				historyDetailData: [],
				deleteFormDetailData: [],
				distribute: {
					personName: '',
					personID: 0
				},
				showDistribute: false
			},
			created: function () {
				var that = this;
				that.appInstalled();
				that.initEvent();

			},
			methods: {
				onRefresh() {
					var that = this;
					that.refreshLoading = true;
					that.$dialog.confirm({
						title: '提示',
						closeOnClickOverlay: true,
						message: '刷新单据可能会还原当前修改信息,是否继续?'
					}).then(() => {
						that.formDetailData = [];
						that.deleteFormDetailData = [];
						that.initEvent();
						setTimeout(function () {
							that.refreshLoading = false;
						}, 1000)
					}).catch(() => {
						that.refreshLoading = false;
					});
				},
				setDataBySelectClient() {
					var that = this;
					FLD.ajax('APP_KHHQCKXXN', { S_ClientID: that.formData.ClientID }, function (res) {
						if (res.ds[0].status == 200) {
							that.formData.BranchID = res.ds[0].BranchID;
							that.formData.BranchName = res.ds[0].BranchName;
							that.formData.StockID = res.ds[0].StockID;
							that.formData.StockName = res.ds[0].StockName;
							that.formData.CargoID = res.ds[0].CargoID;
							that.formData.CargoName = res.ds[0].CargoName;
						}

					})
				},
				clickDom(e) {
					if (!$(e.target).closest('.head-menu').length) {
						this.showMenu = false;
					}
				},
				initEvent() {
					var that = this;
					if (historyData) {
						that.loadingDisabled = false;
						that.type = historyData.B_Type;
						that.billType = historyData.BillType;
						that.isPay = historyData.IsPayN;
						that.formID = historyData.BillID;
						that.payText = historyData.AR_ZT;
						that.sealType = historyData.IsPayZT;
						that.receivableMoney = historyData.YSFMoney;
						that.isAllowApproval = historyData.IsAPFlow;
						that.status = historyData.Status || 0;
						that.CGZT = historyData.CGZT || 0;
						that.formData = {
							ClientID: historyData.ClientID || 0,
							ClientName: historyData.ClientName || '',
							RecMoney: historyData.RecMoney || '',
							PerMoney: historyData.PerMoney || '',
							BranchID: historyData.BranchID || 0,
							BranchName: historyData.BranchName || '',
							EmplID: historyData.EmplID || 0,
							EmplName: historyData.EmplName || '',
							ClassID: historyData.ClassID || 0,
							ClassName: historyData.ClassName || '',
							StockID: historyData.StockID || 0,
							StockName: historyData.StockName || '',
							CargoID: historyData.CargoID || 0,
							CargoName: historyData.CargoName || '',
							ProjectID: historyData.ProjectID || 0,
							ProjectName: historyData.ProjectName || '',
							VIPCardID: historyData.VIPCardID || 0,
							VIPName: historyData.VIPName || '',
							PriceN: historyData.PriceN || 0,
							PriceNName: historyData.PriceNName || '',
							Explain: historyData.Explain || '',
							BType: historyData.BType || '',
							BTypeName: historyData.BTypeName || ''
						}
						// if (that.status == 22) {
						var obj = {
							S_Type: 16,
							S_Cont: that.formData.ClientID,
							S_BranchID: that.formData.BranchID,
							S_SXZ: '',
							S_StockID: that.formData.StockID,
							S_CargoID: that.formData.CargoID,
							S_BarCode: detailString,
							S_PriceN: that.formData.PriceN,
							S_ProductID: 0
						}
						FLD.ajax('AP_BasList', obj, function (res) {
							that.lon = res.ds[0].Longitude;
							that.lat = res.ds[0].Latitude;

						})
						// }
						that.getDetailData();

					}

					if (detailString) {
						var obj = {
							S_Type: 61,
							S_Cont: '',
							S_BranchID: that.formData.BranchID,
							S_SXZ: '',
							S_StockID: that.formData.StockID,
							S_CargoID: that.formData.CargoID,
							S_BarCode: detailString,
							S_PriceN: that.formData.PriceN,
							S_ProductID: 0
						}
						FLD.ajax('AP_BasList', obj, function (res) {

							for (var i in res.ds) {
								var row = res.ds[i];
								that.formDetailData.unshift({
									showDetail: false,
									hasEdit: false,
									id: row.id,
									detailID: 0,
									name: row.name,
									code: row.code,
									spec: row.Spec,
									num: 1,
									price: row.BPrice || 0,
									stockID: vm.formData.StockID,
									stockName: vm.formData.StockName,
									cargoID: vm.formData.CargoID,
									cargoName: vm.formData.CargoName,
									stockNum: row.StockNum,
									unit: row.Unit,
									remark: row.SPBZ
								})
							}

						})
					}
					if (draftID) {
						var that = this;
						var sql = "select * from Draft where DraftID='" + draftID + "'";
						DB.selectSql(sql, function (data) {
							that.formData = JSON.parse(data[0].JSONStr1);
							that.formDetailData = JSON.parse(data[0].JSONStr2);
						})
					}


					if (that.type == 0 && !draftID) {

						var obj = {
							S_Type: 111,
							S_Cont: '',
							S_BranchID: that.formData.BranchID,
							S_SXZ: '',
							S_StockID: that.formData.StockID,
							S_CargoID: that.formData.CargoID,
							S_BarCode: detailString,
							S_PriceN: that.formData.PriceN,
							S_ProductID: 0
						}
						FLD.ajax('AP_BasList', obj, function (res) {
							that.outgoingMode = res.ds;
							that.showMode = true;
						})
					}

					FLD.ajax('app_GetServiceRemark',{},function(res){
						that.serviceRemark = res.ds[0].ServiceRemark;
					})
				},
				appInstalled(num) {
					var that = this;
					if ((num = num ? num : 0) < maps.length) {
						api.appInstalled({
							appBundle: api.systemType == 'ios' ? maps[num][1] : maps[num][2]
						}, function (ret, err) {
							if (ret.installed) {
								buttons.push(maps[num][0]);
								maps[num].push(false);
							} else {
								buttons.push(maps[num][0] + ' ( 未安装 )');
								maps[num].push(true);
							}
							that.appInstalled(++num);
						});
					}
				},
				openNavigation() {
					var that = this;

					if (that.lon && that.lat) {
						api.actionSheet({
							buttons: buttons
						}, function (ret, err) {
							ret.buttonIndex -= 1;
							if (ret.buttonIndex == 2) {
								return false;
							} if (!maps[ret.buttonIndex][3]) {
								if (ret.buttonIndex == 0) {
									var gd_latlng = that.bd_decrypt(that.lon, that.lat);
									if (api.systemType == 'ios') {
										location.href = encodeURI('iosamap://path?sourceApplication=福路德&dlat=' + gd_latlng.lat + '&dlon=' + gd_latlng.lng + '&dev=1&t=0');
									} else {
										location.href = encodeURI('amapuri://route/plan/?sourceApplication=福路德&dlat=' + gd_latlng.lat + '&dlon=' + gd_latlng.lng + '&dev=1&t=0');
									}
								} else if (ret.buttonIndex == 1) {
									if (api.systemType == 'ios') {
										location.href = encodeURI('baidumap://map/direction?destination=' + that.lat + ',' + that.lon + '&mode=driving&src=ios.baidu.福路德连锁');
									} else {
										location.href = encodeURI('bdapp://map/direction?destination=' + that.lat + ',' + that.lon + '&mode=driving&src=andr.baidu.福路德连锁');
									}
								}
							}
						})
					} else {
						layer.open({
							content: '请先保存客户定位!',
							skin: 'msg',
							time: 2
						});
					}
				},
				bd_decrypt(bd_lng, bd_lat) {
					var X_PI = 3.14159265358979324 * 3000.0 / 180.0;
					var x = bd_lng - 0.0065;
					var y = bd_lat - 0.006;
					var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * X_PI);
					var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * X_PI);
					var gg_lng = z * Math.cos(theta);
					var gg_lat = z * Math.sin(theta);
					return { lng: gg_lng, lat: gg_lat }
				},
				selectMode(row) {
					this.formData.BTypeName = row.name;
					this.formData.BType = row.id;
					this.showMode = false;
				},
				getSealImage() {
					var that = this;
					if (that.sealType == 1) {
						return '../image/confirmed.png';
					}
					if (that.sealType == 2) {
						return '../image/paying.png';
					}
					if (that.sealType == 3) {
						return '../image/payed.png';
					}
				},
				getApprovalImage() {
					var that = this;
					if (that.status == 22) {
						return '../image/approval/ys.png';
					}
					if (that.status == 24) {
						return '../image/approval/es.png';
					}
					if (that.status < 20) {
						return '../image/approval/ws.png';
					}
				},
				getDetailData() {
					var that = this;
					var obj = {
						S_BillType: 101,
						S_B_Type: that.type,
						S_BillID: that.formID
					}
					that.showLoading = true;
					FLD.ajax('AP_HisListDe_A', obj, function (res) {
						that.showLoading = false;
						if (res.ds[0].status && res.ds[0].status == 500) {
							layer.open({
								content: res.ds[0].msg,
								skin: 'msg',
								time: 2
							});
						} else {
							that.historyDetailData = JSON.parse(JSON.stringify(res.ds));
							for (var i in res.ds) {
								var row = res.ds[i];
								that.formDetailData.push({
									showDetail: false,
									hasEdit: false,
									id: row.ProductID,
									detailID: row.BillDeID,
									name: row.ProductName,
									code: row.ProductCode,
									spec: row.ProductSpec,
									num: row.BNum,
									price: row.DPrice || 0,
									stockID: row.StockID,
									stockName: row.StockName,
									cargoID: row.CargoID,
									cargoName: row.CargoName,
									stockNum: row.StockNum,
									unit: row.UnitName,
									remark: row.SPBZ
								})
							}
						}
					})
				},
				reduceCount() {
					if (this.formDetailData.length && this.formData.RecMoney) {
						this.formData.PerMoney = this.getTotalPrice() - this.formData.RecMoney;
					}
				},
				changeStepper(row) {
					row.hasEdit = true;
				},
				openBranchChange() {
					var that = this;
					if (that.formDetailData.length) {
						layer.open({
							content: '已选择出库商品,分支机构选择禁用!',
							skin: 'msg',
							time: 2
						});
						return false;
					}
					that.openScreen(-1, 99);
				},
				openScreen(type, index) {
					if (index == 60) {
						if (!this.formData.ClientName) {
							layer.open({
								content: '请先选择往来单位!',
								skin: 'msg',
								time: 2
							});
							return false;
						}
						if (!this.formData.StockName) {
							layer.open({
								content: '请先选择仓库!',
								skin: 'msg',
								time: 2
							});
							return false;
						}
					}
					var obj = null;
					if (index == 30 && type > -1) {
						obj = {
							S_Type: index,
							S_Cont: '',
							S_BranchID: this.formData.BranchID,
							S_SXZ: '',
							S_StockID: this.formData.StockID,
							S_CargoID: this.formData.CargoID,
							S_BarCode: '',
							S_PriceN: this.formData.PriceN,
							S_ProductID: this.formDetailData[type].id
						}
					} else if (index == 31 && type > -1) {
						obj = {
							S_Type: index,
							S_Cont: '',
							S_BranchID: this.formData.BranchID,
							S_SXZ: this.formDetailData[type].stockID,
							S_StockID: this.formData.StockID,
							S_CargoID: this.formData.CargoID,
							S_BarCode: '',
							S_PriceN: this.formData.PriceN,
							S_ProductID: this.formDetailData[type].id
						}
					} else {
						obj = {
							S_Type: index,
							S_Cont: '',
							S_BranchID: this.formData.BranchID,
							S_SXZ: '',
							S_StockID: this.formData.StockID,
							S_CargoID: this.formData.CargoID,
							S_BarCode: '',
							S_PriceN: this.formData.PriceN,
							S_ProductID: 0,
							W_ClientID:this.formData.ClientID
						}
					}

					if (index == 60) {
						api.openWin({
							name: '筛选' + index,
							url: 'common/commodityScreen.html',
							reload: true,
							slidBackEnabled: false,
							pageParam: {
								filterData: obj,
								type: type
							}
						})
					} else {
						api.openWin({
							name: '筛选' + index,
							url: 'common/baseScreen.html',
							reload: true,
							slidBackEnabled: false,
							pageParam: {
								filterData: obj,
								type: type,
								allowClear: false
							}
						})
					}

				},
				openScan() {
					var that = this;


					if (!this.formData.ClientName) {
						layer.open({
							content: '请先选择往来单位!',
							skin: 'msg',
							time: 2
						});
						return false;
					}
					if (!this.formData.StockName) {
						layer.open({
							content: '请先选择仓库!',
							skin: 'msg',
							time: 2
						});
						return false;
					}
					FNScanner.open({
						autorotation: true
					}, function (ret, err) {
						if (ret) {
							if (ret.eventType == 'success') {
								var obj = {
									S_Type: 60,
									S_Cont: '',
									S_BranchID: that.formData.BranchID,
									S_SXZ: '',
									S_StockID: that.formData.StockID,
									S_CargoID: that.formData.CargoID,
									S_BarCode: ret.content,
									S_PriceN: that.formData.PriceN,
									S_ProductID: 0
								}
								FLD.ajax('AP_BasList', obj, function (res) {
									if (res.ds.length == 0) {
										layer.open({
											content: '当前二维码未查询到商品!',
											skin: 'msg',
											time: 2
										});
										return false;
									}
									var row = res.ds[0];
									if (row.StockNum == 0) {
										layer.open({
											content: '当前库位库存不足!',
											skin: 'msg',
											time: 2
										});
									}
									var p_obj = {
										S_BranchID: that.formData.BranchID,
										S_ClientID: that.formData.ClientID,
										S_ProductID: row.id
									}
									FLD.ajax('APP_GETPCNC', p_obj, function (res) {
										that.formDetailData.unshift({
											showDetail: false,
											hasEdit: false,
											id: row.id,
											detailID: 0,
											name: row.name,
											code: row.code,
											spec: row.Spec,
											num: 1,
											price: res.ds[0].O_DPrice || row.BPrice || 0,
											stockID: vm.formData.StockID,
											stockName: vm.formData.StockName,
											cargoID: vm.formData.CargoID,
											cargoName: vm.formData.CargoName,
											stockNum: row.StockNum,
											unit: row.Unit,
											remark: row.SPBZ
										})
									})


								})
							}
						} else {
							layer.open({
								content: '扫描失败!',
								skin: 'msg',
								time: 2
							});

						}
					});
				},
				deleteRow(row, index) {
					this.$dialog.confirm({
						title: '提示',
						message: '是否删除该商品?'
					}).then(() => {
						if (row.detailID != 0) {
							this.deleteFormDetailData.push(row);
						}
						this.formDetailData.splice(index, 1);


					}).catch(() => {

					});

				},
				submitForm() {
					var that = this;
					if (that.formDetailData.length == 0) {
						layer.open({
							content: '请选择出库商品',
							skin: 'msg',
							time: 2
						});
						return false;
					}
					if (!that.formData.BTypeName) {
						layer.open({
							content: '请选择出库类型',
							skin: 'msg',
							time: 2
						});
						return false;
					}
					if (parseFloat(that.receivableMoney) + that.getTotalPrice() - (that.formData.PerMoney || 0) <= 0 && !that.formData.RecMoney) {
						that.$dialog.confirm({
							title: '提示',
							closeOnClickOverlay: true,
							message: '当前客户账户余额为' + (-that.receivableMoney) + '元,本次出库无需收款,是否确认提交?'
						}).then(() => {
							that.submitSQL();
						}).catch(() => {

						});

					} else {
						if (that.formData.RecMoney) {
							if (that.formData.PerMoney || that.formData.PerMoney === 0 || that.getTotalPrice() == that.formData.RecMoney) {
								var message = '是否确认提交?';
								if (parseFloat(that.receivableMoney) + that.getTotalPrice() - (that.formData.PerMoney || 0) <= 0) {
									message = '当前客户账户余额为' + (-that.receivableMoney) + '元,本次出库无需收款,当前收款' + that.formData.RecMoney + '元,是否继续收款?';
								}
								that.$dialog.confirm({
									title: '提示',
									closeOnClickOverlay: true,
									message: message
								}).then(() => {
									that.submitSQL();
								}).catch(() => {

								});
							} else {
								if (parseFloat(that.receivableMoney) + that.getTotalPrice() - (that.formData.PerMoney || 0) <= 0) {
									that.$dialog.confirm({
										title: '提示',
										closeOnClickOverlay: true,
										message: '当前客户账户余额为' + (-that.receivableMoney) + '元,本次出库无需收款,当前收款' + that.formData.RecMoney + '元,是否继续收款?'
									}).then(() => {
										that.collectedAmount = parseFloat(that.formData.RecMoney);
										that.moneyPay();
									}).catch(() => {

									});
								} else {
									// that.collectedAmount = parseFloat(that.formData.RecMoney);
									// that.moneyPay();
									// that.formData.PerMoney = 0;
									that.$dialog.confirm({
										title: '提示',
										closeOnClickOverlay: true,
										message: '是否确认提交'
									}).then(() => {
										that.submitSQL();
									}).catch(() => {

									});
								}

							}

						} else {
							if (that.isPaySubmit) {
								that.$dialog.confirm({
									title: '提示',
									closeOnClickOverlay: true,
									message: '是否确认提交'
								}).then(() => {
									that.submitSQL();
								}).catch(() => {

								});
							} else {
								// that.$dialog.confirm({
								// 	title: '提示',
								// 	closeOnClickOverlay: true,
								// 	message: '是否确认收款?',
								// 	cancelButtonText: '不收款',
								// 	confirmButtonText: '收款'
								// }).then(() => {
								// 	that.collectedAmount = that.getTotalPrice();
								// 	that.showPay = true;
								// }).catch((eventType) => {
								// 	if (eventType == 'cancel') {
								// 		that.submitSQL();
								// 	}
								// });
								that.$dialog.confirm({
									title: '提示',
									closeOnClickOverlay: true,
									message: '是否确认提交'
								}).then(() => {
									that.submitSQL();
								}).catch(() => {

								});
							}

						}
					}


				},
				moneyPay() {
					var that = this;
					var m = 0;
					// var m1 = userInfo.S_MaxPerMoney;
					// var m2 = that.getTotalPrice() * userInfo.S_MaxPerMBL;
					// if (m1 > m2) {
					// 	m = m1;
					// } else {
					// 	m = m2;
					// }
					m = that.formData.PerMoney ? that.formData.PerMoney : 0;

					that.$dialog.confirm({
						title: '提示',
						closeOnClickOverlay: true,
						message: '是否确认提交?'
					}).then(() => {
						that.formData.RecMoney = that.collectedAmount;
						that.formData.PerMoney = m;
						that.submitSQL();
					}).catch(() => {

					});

					// if (m == 0) {
					// 	that.$dialog.confirm({
					// 		title: '提示',
					// 		closeOnClickOverlay: true,
					// 		message: '当前抹零上限为零,是否确认提交?'
					// 	}).then(() => {
					// 		that.formData.RecMoney = that.collectedAmount;
					// 		that.formData.PerMoney = 0;
					// 		that.submitSQL();
					// 	}).catch(() => {

					// 	});

					// } else {

					// 	if (!that.formData.PerMoney) {
					// 		that.$dialog.confirm({
					// 			title: '提示',
					// 			closeOnClickOverlay: true,
					// 			message: '当前未收款' + (that.getTotalPrice() - that.collectedAmount) + '元,可用抹零上限为' + m + '元,是否抹零?',
					// 			cancelButtonText: '不抹零',
					// 			confirmButtonText: '抹零',
					// 			beforeClose: function (action, done) {
					// 				if (action == 'overlay') {
					// 					done();
					// 				} else if (action == 'confirm') {
					// 					done();
					// 					that.formData.RecMoney = m;
					// 					// that.reduceCount();
					// 					that.submitSQL();
					// 				} else if (action == 'cancel') {
					// 					done();
					// 					that.formData.RecMoney = that.collectedAmount;
					// 					that.formData.PerMoney = 0;
					// 					that.submitSQL();
					// 				}
					// 			}
					// 		})

					// 	} else {
					// 		if (m > that.formData.PerMoney) {
					// 			that.$dialog.confirm({
					// 				title: '提示',
					// 				closeOnClickOverlay: true,
					// 				message: '是否确认提交?'
					// 			}).then(() => {
					// 				that.formData.RecMoney = that.collectedAmount;
					// 				that.submitSQL();
					// 			}).catch(() => {

					// 			});
					// 		} else {
					// 			that.$dialog.confirm({
					// 				title: '提示',
					// 				closeOnClickOverlay: true,
					// 				message: '当前抹零上限为' + m + '元,是否确认提交?'
					// 			}).then(() => {
					// 				that.formData.RecMoney = that.collectedAmount;
					// 				that.formData.PerMoney = m;
					// 				that.submitSQL();
					// 			}).catch(() => {

					// 			});
					// 		}
					// 	}


					// }

				},
				draftSave() {
					var that = this;
					var S_STRZB = [2, that.type, that.formID];
					for (var i in that.formData) {
						if (i == 'RecMoney' || i == 'PerMoney') {
							S_STRZB.push('\'' + (that.formData[i] || 0) + '\'');
						} else {
							S_STRZB.push('\'' + that.formData[i] + '\'');
						}

					}
					var S_STRDe = [];
					for (var i in that.formDetailData) {
						var detailArray = [];
						detailArray.push(
							'\'' + (that.formDetailData[i].detailID == 0 ? 1 : (that.formDetailData[i].hasEdit ? 2 : 0)) + '\'',
							'\'' + that.type + '\'',
							'\'' + that.formID + '\'',
							'\'' + that.formDetailData[i].detailID + '\'',
							'\'' + that.formDetailData[i].id + '\'',
							'\'' + that.formDetailData[i].name + '\'',
							'\'' + that.formDetailData[i].code + '\'',
							'\'' + that.formDetailData[i].spec + '\'',
							'\'' + that.formDetailData[i].num + '\'',
							'\'' + that.formDetailData[i].price + '\'',
							'\'' + (that.formDetailData[i].num * that.formDetailData[i].price).toFixed(2) + '\'',
							'\'' + that.formDetailData[i].stockID + '\'',
							'\'' + that.formDetailData[i].stockName + '\'',
							'\'' + that.formDetailData[i].cargoID + '\'',
							'\'' + that.formDetailData[i].cargoName + '\''
						)
						S_STRDe.push(detailArray.join(','))
					}
					for (var i in that.deleteFormDetailData) {
						var detailArray = [];
						detailArray.push(
							'\'' + 3 + '\'',
							'\'' + that.type + '\'',
							'\'' + that.formID + '\'',
							'\'' + that.deleteFormDetailData[i].detailID + '\'',
							'\'' + that.deleteFormDetailData[i].id + '\'',
							'\'' + that.deleteFormDetailData[i].name + '\'',
							'\'' + that.deleteFormDetailData[i].code + '\'',
							'\'' + that.deleteFormDetailData[i].spec + '\'',
							'\'' + that.deleteFormDetailData[i].num + '\'',
							'\'' + that.deleteFormDetailData[i].price + '\'',
							'\'' + (that.deleteFormDetailData[i].num * that.deleteFormDetailData[i].price).toFixed(2) + '\'',
							'\'' + that.deleteFormDetailData[i].stockID + '\'',
							'\'' + that.deleteFormDetailData[i].stockName + '\'',
							'\'' + that.deleteFormDetailData[i].cargoID + '\'',
							'\'' + that.deleteFormDetailData[i].cargoName + '\''
						)
						S_STRDe.push(detailArray.join(','));
					}
					var obj = {
						S_BillType: 101,
						S_STRZB: S_STRZB.join(),
						S_STRDe: S_STRDe.join('|')
					}
					that.ifConfirm = true;
					FLD.ajax('APP_XSCKCGXG', obj, function (res) {
						that.ifConfirm = false;
						if (res.ds[0].status == 200) {
							layer.open({
								content: '修改成功',
								skin: 'msg',
								time: 2
							});

							that.formDetailData = [];
							that.deleteFormDetailData = [];

							api.sendEvent({
								name: 'refreshList',
								extra: {
									type: that.type
								}
							});
							that.getDetailData();
						} else {
							layer.open({
								content: res.ds[0].msg,
								skin: 'msg',
								time: 2
							});
						}
					})
				},
				ShortageOut() {
					var that = this;
					that.showMenu = false;
					that.$dialog.confirm({
						title: '提示',
						closeOnClickOverlay: true,
						message: '是否确认订货退回?'
					}).then(() => {
						var obj = {
							S_KeyID: that.formID
						}
						FLD.ajax('APP_DHCKTHAN', obj, function (res) {
							if (res.ds[0].status == 200) {
								layer.open({
									content: '订货退回成功',
									skin: 'msg',
									time: 2
								});
								that.CGZT = 3;
								api.sendEvent({
									name: 'refreshList',
									extra: {
										type: 1
									}
								});

								api.sendEvent({
									name: 'refreshList',
									extra: {
										type: 2
									}
								});
							} else {
								layer.open({
									content: res.ds[0].msg,
									skin: 'msg',
									time: 2
								});
							}
						})
					}).catch(() => {

					});
				},
				reOrderOut() {
					var that = this;
					that.showMenu = false;
					that.$dialog.confirm({
						title: '提示',
						closeOnClickOverlay: true,
						message: '是否确认重新订货出库?'
					}).then(() => {
						var obj = {
							S_BillType: 101,
							S_KeyID: that.formID
						}
						FLD.ajax('APP_XSCKDHANN', obj, function (res) {
							if (res.ds[0].status == 200) {
								layer.open({
									content: '重新订货出库成功',
									skin: 'msg',
									time: 2
								});
								that.CGZT = 2;
								api.sendEvent({
									name: 'refreshList',
									extra: {
										type: 1
									}
								});

								api.sendEvent({
									name: 'refreshList',
									extra: {
										type: 2
									}
								});
							} else {
								layer.open({
									content: res.ds[0].msg,
									skin: 'msg',
									time: 2
								});
							}
						})
					}).catch(() => {

					});
				},
				distributeOrder() {
					var that = this;
					that.showMenu = false;
					that.showDistribute = true;
				},
				orderOut() {
					var that = this;
					that.showMenu = false;
					that.$dialog.confirm({
						title: '提示',
						closeOnClickOverlay: true,
						message: '是否确认订货出库?'
					}).then(() => {
						var obj = {
							S_BillType: 101,
							S_KeyID: that.formID
						}
						FLD.ajax('APP_XSCKDHANN', obj, function (res) {
							if (res.ds[0].status == 200) {
								layer.open({
									content: '订货出库成功',
									skin: 'msg',
									time: 2
								});
								that.CGZT = 2;
								api.sendEvent({
									name: 'refreshList',
									extra: {
										type: 1
									}
								});

								api.sendEvent({
									name: 'refreshList',
									extra: {
										type: 2
									}
								});
							} else {
								layer.open({
									content: res.ds[0].msg,
									skin: 'msg',
									time: 2
								});
							}
						})
					}).catch(() => {

					});
				},
				distributeSubmit() {
					var that = this;

					if (!that.distribute.personID) {
						layer.open({
							content: '请选择拣货出库人员',
							skin: 'msg',
							time: 2
						});
						return false;
					}
					that.showDistribute = false;
					that.$dialog.confirm({
						title: '提示',
						closeOnClickOverlay: true,
						message: '是否确认拣货出库?'
					}).then(() => {
						var obj = {
							S_BType: -1,
							S_KeyID: that.formID,
							S_UserID: that.distribute.personID,
							S_BillType: that.billType
						}
						that.ifConfirm = true;
						FLD.ajax('APP_JHJKCLNMX', obj, function (res) {
							that.ifConfirm = false;
							if (res.ds[0].status == 200) {
								that.distribute.personID = 0;
								that.distribute.personName = '';
								layer.open({
									content: '拣货出库成功',
									skin: 'msg',
									time: 2
								});
							} else {
								layer.open({
									content: res.ds[0].msg,
									skin: 'msg',
									time: 2
								});
							}
						})
					}).catch(() => {

					});
				},
				draftSubmitForm() {
					var that = this;
					that.$dialog.confirm({
						title: '提示',
						closeOnClickOverlay: true,
						message: '是否确认提交?'
					}).then(() => {
						that.submitSQL();
					}).catch(() => {

					});
				},
				submitSQL() {
					var that = this;

					if (that.type == 0) {
						var S_STRZB = [];
						for (var i in that.formData) {
							if (i == 'RecMoney' || i == 'PerMoney') {
								S_STRZB.push('\'' + (that.formData[i] || 0) + '\'');
							} else {
								S_STRZB.push('\'' + that.formData[i] + '\'');
							}

						}
						var S_STRDe = [];
						for (var i in that.formDetailData) {
							var detailArray = [];
							detailArray.push(
								'\'' + that.formDetailData[i].id + '\'',
								'\'' + that.formDetailData[i].name + '\'',
								'\'' + that.formDetailData[i].code + '\'',
								'\'' + that.formDetailData[i].spec + '\'',
								'\'' + that.formDetailData[i].num + '\'',
								'\'' + that.formDetailData[i].price + '\'',
								'\'' + (that.formDetailData[i].num * that.formDetailData[i].price).toFixed(2) + '\'',
								'\'' + that.formDetailData[i].stockID + '\'',
								'\'' + that.formDetailData[i].stockName + '\'',
								'\'' + that.formDetailData[i].cargoID + '\'',
								'\'' + that.formDetailData[i].cargoName + '\''
							)
							S_STRDe.push(detailArray.join(','))
						}

						var obj = {
							S_BillType: 101,
							S_STRZB: S_STRZB.join(),
							S_STRDe: S_STRDe.join('|')
						}
						that.ifConfirm = true;



						FLD.ajax('AP_XSCKTJ', obj, function (res) {
							that.ifConfirm = false;
							if (res.ds[0].status == 200) {

								//本地数据库删除草稿
								if (draftID) {
									var sql = "delete from Draft where DraftID='" + draftID + "'";
									DB.executeSql(sql, function () {
										api.sendEvent({
											name: 'refreshDraft'
										});
									})
								}


								if (that.isPaySubmit) {
									that.isPaySubmit = false;
									var payMoney = (that.getTotalPrice() - parseFloat(that.formData.PerMoney || 0)).toFixed(2);
									layer.open({
										content: '保存成功,即将跳转支付!',
										skin: 'msg',
										time: 2,
										end: function () {
											api.openWin({
												name: 'pay',
												url: 'common/pay.html',
												reload: true,
												slidBackEnabled: false,
												pageParam: {
													payData: {
														S_BillType: 101,
														S_BillID: res.ds[0].BillID,
														S_UserType: 1,
														S_DMoney: payMoney,
														S_BranchID: that.formData.BranchID,
														S_ClientID: that.formData.ClientID,
														S_PayType: '0'
													},
													payType: 1
												}
											})
										}
									});
								} else {
									layer.open({
										content: '保存成功',
										skin: 'msg',
										time: 2
									});
								}


								that.formData = {
									ClientID: 0,
									ClientName: '',
									RecMoney: '',
									PerMoney: '',
									BranchID: userInfo.S_BranchID || 0,
									BranchName: userInfo.S_BranchName || '',
									EmplID: userInfo.S_EmplID || 0,
									EmplName: userInfo.S_EmplName || '',
									ClassID: userInfo.S_ClassID || 0,
									ClassName: userInfo.S_ClassName || '',
									StockID: userInfo.S_StockID || 0,
									StockName: userInfo.S_StockName || '',
									CargoID: userInfo.S_CargoID || 0,
									CargoName: userInfo.S_CargoName || '',
									ProjectID: userInfo.S_ProjectID || 0,
									ProjectName: userInfo.S_ProjectName || '',
									VIPCardID: 0,
									VIPName: '',
									PriceN: 0,
									PriceNName: '',
									Explain: '',
									BType: '',
									BTypeName: ''
								}
								that.formDetailData = [];


								api.sendEvent({
									name: 'refreshList',
									extra: {
										type: 1
									}
								});

								api.sendEvent({
									name: 'refreshList',
									extra: {
										type: 2
									}
								});


							} else {
								layer.open({
									content: res.ds[0].msg,
									skin: 'msg',
									time: 2
								});
							}
						})
					} else {
						var S_STRZB = [2, that.type, that.formID];
						for (var i in that.formData) {
							if (i == 'RecMoney' || i == 'PerMoney') {
								S_STRZB.push('\'' + (that.formData[i] || 0) + '\'');
							} else {
								S_STRZB.push('\'' + that.formData[i] + '\'');
							}

						}
						var S_STRDe = [];
						for (var i in that.formDetailData) {
							var detailArray = [];
							detailArray.push(
								'\'' + (that.formDetailData[i].detailID == 0 ? 1 : (that.formDetailData[i].hasEdit ? 2 : 0)) + '\'',
								'\'' + that.type + '\'',
								'\'' + that.formID + '\'',
								'\'' + that.formDetailData[i].detailID + '\'',
								'\'' + that.formDetailData[i].id + '\'',
								'\'' + that.formDetailData[i].name + '\'',
								'\'' + that.formDetailData[i].code + '\'',
								'\'' + that.formDetailData[i].spec + '\'',
								'\'' + that.formDetailData[i].num + '\'',
								'\'' + (that.formDetailData[i].price || 0) + '\'',
								'\'' + (that.formDetailData[i].num * (that.formDetailData[i].price || 0)).toFixed(2) + '\'',
								'\'' + that.formDetailData[i].stockID + '\'',
								'\'' + that.formDetailData[i].stockName + '\'',
								'\'' + that.formDetailData[i].cargoID + '\'',
								'\'' + that.formDetailData[i].cargoName + '\''
							)
							S_STRDe.push(detailArray.join(','))
						}
						for (var i in that.deleteFormDetailData) {
							var detailArray = [];
							detailArray.push(
								'\'' + 3 + '\'',
								'\'' + that.type + '\'',
								'\'' + that.formID + '\'',
								'\'' + that.deleteFormDetailData[i].detailID + '\'',
								'\'' + that.deleteFormDetailData[i].id + '\'',
								'\'' + that.deleteFormDetailData[i].name + '\'',
								'\'' + that.deleteFormDetailData[i].code + '\'',
								'\'' + that.deleteFormDetailData[i].spec + '\'',
								'\'' + that.deleteFormDetailData[i].num + '\'',
								'\'' + (that.deleteFormDetailData[i].price || 0) + '\'',
								'\'' + (that.deleteFormDetailData[i].num * (that.deleteFormDetailData[i].price || 0)).toFixed(2) + '\'',
								'\'' + that.deleteFormDetailData[i].stockID + '\'',
								'\'' + that.deleteFormDetailData[i].stockName + '\'',
								'\'' + that.deleteFormDetailData[i].cargoID + '\'',
								'\'' + that.deleteFormDetailData[i].cargoName + '\''
							)
							S_STRDe.push(detailArray.join(','));
						}
						var obj = {
							S_BillType: 101,
							S_STRZB: S_STRZB.join(),
							S_STRDe: S_STRDe.join('|')
						}
						that.ifConfirm = true;
						FLD.ajax('AP_MdfXSCKTJ', obj, function (res) {
							that.ifConfirm = false;
							if (res.ds[0].status == 200) {



								if (that.isPaySubmit) {
									that.isPaySubmit = false;
									var payMoney = (that.getTotalPrice() - parseFloat(that.formData.PerMoney || 0)).toFixed(2);
									layer.open({
										content: '即将跳转支付',
										skin: 'msg',
										time: 2,
										end: function () {
											api.openWin({
												name: 'pay',
												url: 'common/pay.html',
												reload: true,
												slidBackEnabled: false,
												pageParam: {
													payData: {
														S_BillType: 101,
														S_BillID: that.formID,
														S_UserType: 1,
														S_DMoney: payMoney,
														S_BranchID: that.formData.BranchID,
														S_ClientID: that.formData.ClientID,
														S_PayType: '0'
													},
													payType: 1
												}
											})
										}
									});
								} else {
									layer.open({
										content: '修改成功',
										skin: 'msg',
										time: 2
									});
								}

								if (that.type == 1) {
									that.type = 0;
									that.isPay = 0;
									that.formID = 0;
									that.payText = '支付';
									that.sealType = 0;
									that.receivableMoney = 0;
									that.isAllowApproval = 0;
									that.status = 0;
									that.formData = {
										ClientID: 0,
										ClientName: '',
										RecMoney: '',
										PerMoney: '',
										BranchID: userInfo.S_BranchID || 0,
										BranchName: userInfo.S_BranchName || '',
										EmplID: userInfo.S_EmplID || 0,
										EmplName: userInfo.S_EmplName || '',
										ClassID: userInfo.S_ClassID || 0,
										ClassName: userInfo.S_ClassName || '',
										StockID: userInfo.S_StockID || 0,
										StockName: userInfo.S_StockName || '',
										CargoID: userInfo.S_CargoID || 0,
										CargoName: userInfo.S_CargoName || '',
										ProjectID: userInfo.S_ProjectID || 0,
										ProjectName: userInfo.S_ProjectName || '',
										VIPCardID: 0,
										VIPName: '',
										PriceN: 0,
										PriceNName: '',
										Explain: '',
										BType: '',
										BTypeName: ''
									}
									that.formDetailData = [];
								} else {
									that.formDetailData = [];
									that.deleteFormDetailData = [];
									that.getDetailData();
								}

								api.sendEvent({
									name: 'refreshList',
									extra: {
										type: 1
									}
								});

								api.sendEvent({
									name: 'refreshList',
									extra: {
										type: 2
									}
								});

							} else {
								layer.open({
									content: res.ds[0].msg,
									skin: 'msg',
									time: 2
								});
							}
						})
					}
				},
				payForm() {
					var that = this;

					if (that.status > 20) {
						var totalPrice = 0;
						for (var i in that.historyDetailData) {
							totalPrice += that.historyDetailData[i].BNum * (that.historyDetailData[i].DPrice || 0)
						}
						totalPrice = totalPrice.toFixed(2);
						var payMoney = (totalPrice - parseFloat(historyData.PerMoney || 0)).toFixed(2);
						layer.open({
							content: '即将跳转支付',
							skin: 'msg',
							time: 2,
							end: function () {
								api.openWin({
									name: 'pay',
									url: 'common/pay.html',
									reload: true,
									slidBackEnabled: false,
									pageParam: {
										payData: {
											S_BillType: 101,
											S_BillID: historyData.BillID,
											S_UserType: 1,
											S_DMoney: payMoney,
											S_BranchID: historyData.BranchID,
											S_ClientID: historyData.ClientID,
											S_PayType: '0'
										},
										payType: 1
									}
								})
							}
						});
					} else {
						that.isPaySubmit = true;
						that.submitForm();
					}

				},
				approvalForm() {
					var that = this;
					that.showMenu = false;
					that.showApproval = true;
				},
				postingForm() {
					var that = this;
					that.showMenu = false;
					that.showLoading = true;
					var obj = {
						S_BillType: 101,
						S_BillID: that.formID
					}
					FLD.ajax('AP_APGZ_GN', obj, function (res) {
						that.showLoading = false;
						if (res.ds[0].status && res.ds[0].status == 500) {
							layer.open({
								content: res.ds[0].msg,
								skin: 'msg',
								time: 2
							});
						} else {
							layer.open({
								content: '审核过账成功',
								skin: 'msg',
								time: 2,
								end: function () {
									if (that.status >= 80) {
										var obj = {
											S_BillType: 101,
											S_BillID: that.formID
										}
										FLD.ajax('AP_HisList_XX', obj, function (res) {
											if (res.ds.length) {
												var row = res.ds[0];
												api.openWin({
													name: 'selling',
													url: 'sellingPrint.html',
													reload: true,
													slidBackEnabled: false,
													pageParam: {
														historyData: row
													}
												})
											}
										})
									}
								}
							});
							api.sendEvent({
								name: 'refreshList',
								extra: {
									type: 2
								}
							});
							api.sendEvent({
								name: 'refreshList',
								extra: {
									type: 3
								}
							});
						}
					})
				},
				approvalConfirm() {
					var that = this;
					that.ifConfirm = true;
					that.showApproval = false;
					var obj = {
						S_KeyID: that.formID,
						S_BillType: 101,
						S_BranchID: that.formData.BranchID,
						S_Status: that.status,
						S_ANZY: 1,
						S_CLYY: that.approvalReason
					}
					FLD.ajax('APP_BillFolwA', obj, function (res) {
						that.ifConfirm = false;

						if (res.ds[0].status == 200) {
							that.approvalReason = '';
							that.status = res.ds[0].BStatus;
							layer.open({
								content: '审批成功',
								skin: 'msg',
								time: 2,
								end: function () {
									if (that.status >= 80) {
										var obj = {
											S_BillType: 101,
											S_BillID: that.formID
										}
										FLD.ajax('AP_HisList_XX', obj, function (res) {
											if (res.ds.length) {
												var row = res.ds[0];
												api.openWin({
													name: 'selling',
													url: 'sellingPrint.html',
													reload: true,
													slidBackEnabled: false,
													pageParam: {
														historyData: row
													}
												})
											}
										})
									} else {
										that.refreshForm();
									}
								}
							});
							api.sendEvent({
								name: 'refreshList',
								extra: {
									type: 2
								}
							});
							api.sendEvent({
								name: 'refreshList',
								extra: {
									type: 3
								}
							});
						} else {
							layer.open({
								content: res.ds[0].msg,
								skin: 'msg',
								time: 2,
								end: function () {
									if (res.ds[0].status == 501) {
										that.refreshForm();
									}
								}
							});
						}
					})
				},
				approvalCancel() {
					var that = this;
					that.ifConfirm = true;
					that.showApproval = false;
					var obj = {
						S_KeyID: that.formID,
						S_BillType: 101,
						S_BranchID: that.formData.BranchID,
						S_Status: that.status,
						S_ANZY: 2,
						S_CLYY: that.approvalReason
					}
					FLD.ajax('APP_BillFolwA', obj, function (res) {
						that.ifConfirm = false;
						if (res.ds[0].status == 200) {
							that.approvalReason = '';
							that.status = res.ds[0].BStatus;
							layer.open({
								content: '审批成功',
								skin: 'msg',
								time: 2
							});
							api.sendEvent({
								name: 'refreshList',
								extra: {
									type: 2
								}
							});
							api.sendEvent({
								name: 'refreshList',
								extra: {
									type: 3
								}
							});
						} else {
							layer.open({
								content: res.ds[0].msg,
								skin: 'msg',
								time: 2,
								end: function () {
									if (res.ds[0].status == 501) {
										that.refreshForm();
									}
								}
							});
						}
					})
				},
				openDraft() {
					api.openWin({
						name: 'draft',
						url: 'draft.html',
						reload: true,
						slidBackEnabled: false,
						pageParam: {
							tabActive: 0
						}
					})
				},
				refreshForm() {
					var that = this;
					var obj = {
						S_BillType: 101,
						S_BillID: that.formID
					}
					FLD.ajax('AP_HisList_XX', obj, function (res) {
						if (res.ds.length) {
							var row = res.ds[0];
							if (row.B_Type == 3) {
								api.openWin({
									name: 'selling',
									url: 'sellingPrint.html',
									reload: true,
									slidBackEnabled: false,
									pageParam: {
										historyData: row
									}
								})
							} else {
								api.openWin({
									name: 'selling',
									url: 'selling.html',
									reload: true,
									slidBackEnabled: false,
									pageParam: {
										historyData: row
									}
								})
							}
						}
					})
				},
				saveLocal() {
					var that = this;
					that.showMenu = false;
					// var jsonstr1 = JSON.stringify(that.formData).replace(/\'/g, '\'\'')
					// var jsonstr2 = JSON.stringify(that.formDetailData).replace(/\'/g, '\'\'')
					// if (draftID) {
					// 	var sql = "update Draft set JSONStr1='" + jsonstr1 + "',JSONStr2='" + jsonstr2 + "',UpdateTime='" + FLD.getFormatDate() + "' where DraftID='" + draftID + "'";
					// 	DB.executeSql(sql, function () {
					// 		layer.open({
					// 			content: '保存成功',
					// 			skin: 'msg',
					// 			time: 2
					// 		});
					// 		api.sendEvent({
					// 			name: 'refreshDraft'
					// 		});
					// 	})
					// } else {
					// 	var sql = "insert into Draft (JSONStr1,JSONStr2,CreateTime,UpdateTime,Type,Status) values ('" + jsonstr1 + "','" + jsonstr2 + "','" + FLD.getFormatDate() + "',null,101,null)"
					// 	DB.executeSql(sql, function () {
					// 		layer.open({
					// 			content: '保存成功',
					// 			skin: 'msg',
					// 			time: 2
					// 		});
					// 	})
					// }

					var S_STRZB = [];
					for (var i in that.formData) {
						if (i == 'RecMoney' || i == 'PerMoney') {
							S_STRZB.push('\'' + (that.formData[i] || 0) + '\'');
						} else {
							S_STRZB.push('\'' + that.formData[i] + '\'');
						}

					}
					var S_STRDe = [];
					for (var i in that.formDetailData) {
						var detailArray = [];
						detailArray.push(
							'\'' + that.formDetailData[i].id + '\'',
							'\'' + that.formDetailData[i].name + '\'',
							'\'' + that.formDetailData[i].code + '\'',
							'\'' + that.formDetailData[i].spec + '\'',
							'\'' + that.formDetailData[i].num + '\'',
							'\'' + that.formDetailData[i].price + '\'',
							'\'' + (that.formDetailData[i].num * that.formDetailData[i].price).toFixed(2) + '\'',
							'\'' + that.formDetailData[i].stockID + '\'',
							'\'' + that.formDetailData[i].stockName + '\'',
							'\'' + that.formDetailData[i].cargoID + '\'',
							'\'' + that.formDetailData[i].cargoName + '\''
						)
						S_STRDe.push(detailArray.join(','))
					}

					var obj = {
						S_BillType: 101,
						S_STRZB: S_STRZB.join(),
						S_STRDe: S_STRDe.join('|')
					}
					that.ifConfirm = true;
					FLD.ajax('APP_XSCKCGTJ', obj, function (res) {
						that.ifConfirm = false;
						if (res.ds[0].status == 200) {
							api.sendEvent({
								name: 'refreshList',
								extra: {
									type: 1
								}
							});
							that.checkArray = [];
							layer.open({
								content: '保存成功',
								skin: 'msg',
								time: 2
							});
						} else {
							layer.open({
								content: res.ds[0].msg,
								skin: 'msg',
								time: 2
							});
						}
					})

				},
				getTotalCount() {
					var totalCount = 0;
					for (var i in this.formDetailData) {
						totalCount += this.formDetailData[i].num
					}
					return totalCount;
				},
				getTotalPrice() {
					var totalPrice = 0;
					for (var i in this.formDetailData) {
						totalPrice += this.formDetailData[i].num * this.formDetailData[i].price
					}
					return totalPrice.toFixed(2);
				},
				toggleShowMain() {
					this.showMain = !this.showMain;
				},
				toggleShowDetail(row) {
					row.showDetail = !row.showDetail;
				},
				printBill() {
					var that = this;
					that.showMenu = false;
					var obj = {
						S_BranchID: that.formData.BranchID,
						S_ClientID: that.formData.ClientID
					}
					FLD.ajax('AP_PrintIFMN', obj, function (res) {
						var infoData = res.ds[0];
						var nodeArray = [];
						var totalNum = 0;
						for (var i in that.formDetailData) {
							totalNum += that.formDetailData[i].num;
							nodeArray.push({
								'名称': that.formDetailData[i].name,
								'规格': that.formDetailData[i].spec,
								'单位': that.formDetailData[i].unit,
								'数量': that.formDetailData[i].num,
								'单价': that.formDetailData[i].price,
								'金额': (that.formDetailData[i].num * that.formDetailData[i].price).toFixed(2)

							}, {
								'备注': that.formDetailData[i].remark
							})
						}
						var printData = {
							title: '福路德汽配连锁',
							subtitle: '随货同行单',
							top: {
								'客户名称': that.formData.ClientName,
								'客户联系方式': infoData.S_CTel,
								'累计应收': infoData.S_YSYE,
								'会员充值余额': infoData.S_VIPYE
							},
							node: nodeArray,
							center: {
								'合计数量': totalNum,
								'合计金额': that.getTotalPrice(),
							},
							bottom: {
								'公司地址': infoData.S_BAddr,
								'联系人': infoData.S_BLnkM,
								'联系方式': infoData.S_BTel,
							}


						}
						window.localStorage.setItem('printData', JSON.stringify(printData));
						api.openWin({
							name: '打印预览',
							url: 'common/printPreview.html',
							reload: true,
							slidBackEnabled: false
						})
					})



				},
				openHistory() {
					var that = this;
					that.showMenu = false;
					api.openWin({
						name: '历史单据',
						url: 'common/historicalDocuments.html',
						reload: true,
						slidBackEnabled: false,
						pageParam: {
							type: 101
						}
					})
				},
				openCHHistory() {
					var that = this;
					that.showMenu = false;
					api.openWin({
						name: '出货历史单据',
						url: 'shipmentTracking.html',
						reload: true,
						slidBackEnabled: false,
						pageParam: {
							type: -101
						}
					})
				},
				openVin() {
					var that = this;
					that.showMenu = false;
					api.openWin({
						name: 'vin',
						url: 'vin.html',
						reload: true,
						slidBackEnabled: false,
						pageParam: {
							fromType: 1
						}
					})
				},
				onClickLeft() {
					if (this.type == 3) {
						api.closeWin();
					} else {
						this.$dialog.confirm({
							title: '提示',
							message: '是否退出销售出库界面?'
						}).then(() => {
							api.closeWin();
						}).catch(() => {

						});
					}

				}
			}
		})
	};
</script>

</html>